package com.reading.utils;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpSession;

/**
 * @author guwenqi_1995@163.com
 * @date 2019/7/12 11:38 AM
 **/
public class SessionUtil {

    private static HttpSession session = ((ServletRequestAttributes)
            RequestContextHolder.getRequestAttributes()).getRequest().getSession();

    public static void save(String key, Object value) {
        session.setAttribute(key, value);
    }

    public static Object get(String key) {
        return session.getAttribute(key);
    }
}
